﻿@using StevensReceipts.Domain
@model StevensReceipts.Web.Models.EditFinancialViewModel

@{
    ViewBag.Title = "EditFinancial";
}

<h2>Edit Financial</h2>

@using(Html.BeginForm()){

<div>
    <table>
        <tr><td>
                @Html.DropDownListFor(model=>model.FinancialYearEndDay, Model.Days, Model.FinancialYearEndDay)
            </td>
            <td>
                
                @Html.DropDownListFor(model=>model.FinancialYearEndMonth, Model.Months, Model.FinancialYearEndMonth)
            </td>
        </tr>
    </table>
    
    <hr/>
    GST:
    <table>
        <tr><td>GST Basis</td><td>GST Period</td><td>GST Number</td></tr>
        <tr>
            <td>
                @Html.EnumDropDownListFor(model=>model.SelectedGstBasis)
            </td>
            <td id="gstPeriodSection">
                @Html.EnumDropDownListFor(model=>model.SelectedGstPeriod)                                                                               
            </td>
            <td id="gstNumberSection">@Html.TextBoxFor(model=>Model.GstNumber)</td>
        </tr>
    </table>
    <button type="submit">Submit</button>
</div>

}

@section scripts{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#SelectedGstBasis").change(function() {
                var selectedGstBasis = $('#SelectedGstBasis').val();
                if(selectedGstBasis == "None") {
                    $("#gstPeriodSection").hide();
                    $("#gstNumberSection").hide();
                }else {
                    $("#gstPeriodSection").show();
                    $("#gstNumberSection").show();
                }
            });
        });
    </script>

}

